var BASE_URL = 'http://www.aiyi5.com';

// 主页面切换frame
var changeFrameInRoot = function(index){
  api.execScript({
    name: 'root',
    script: 'changeIndexFrame('+index+')'
  });
};

/**
 * [openWin 打开新窗口]
 * @param  {[string]} win    [窗口名称 文件名称]
 * @param  {[object]} params [传递参数]
 * @return {[void]}
 */
function openWin(win, params) {
  var obj = {
    name: win,
    url: './' + win + '.html',
  };
  if (params) obj.pageParam = params;
  api.openWin(obj);
}

// close window
function closeWin() {
  api.closeWin();
}

// show progress
function showProgress() {
  api.showProgress({
    title: '努力加载中...',
    text: '先喝杯茶...',
    modal: false
  });
}

// hide progress
function hideProgress() {
  setTimeout(function() {
    api.hideProgress();
  }, 1000);
}

// toast
function toast(msg) {
  api.toast({
    msg: msg,
    duration: 2000,
    location: 'bottom'
  });
}
